/**
 * 
输入例子：
2
4 1 2 3 4
5 1 2 3 4 5
输出例子：
10
15
 */

const rl = require('readline').createInterface({ input: process.stdin });
var iter = rl[Symbol.asyncIterator]();
const readline = async () => (await iter.next()).value;

void (async function () {
    const times = await readline();

    for (let i = 0; i < times; i++) {
        let line = await readline();

        let tokens = line.split(' ').map((ele) => parseInt(ele));
        tokens.shift();

        const count = tokens.reduce((acc, cur) => acc + cur, 0);
        console.log(count);
    }

    rl.close();
})();
